package com.xyh.dao;

import com.xyh.entity.Person;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface PersonDao extends JpaRepository<Person,Integer>,PersonDaoCustom
{
    //根据名称查询
  List<Person> name(String name);

  //根据findby进行查询
    List<Person> findByNameAndAge(String name,Integer age);
    //根据findby进行查询
    List<Person> findByAgeLessThan(Integer age);
    //jhql 语句实现查询
    @Query("select p from Person p where p.name= ?1")
    List<Person> findPersionName(String name);
    //使用原生的sql语句
    @Query(value = "SELECT * FROM cra_person  WHERE  name= ?1",nativeQuery = true)
    List<Person> findNativeName(String name);
}
